﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace PreProcessing
{
    public partial class Form1 : Form
    {
        Normalizer n;
        Counter c;
        public Form1()
        {
            InitializeComponent();
        }

        private void btProcess_Click(object sender, EventArgs e)
        {
            if (txtPathIn.Text != "" && txtPathOut.Text != "")
            {
                n = new Normalizer();
                n.readfile(txtPathIn.Text);
                n.writetofile(txtPathOut.Text);
                MessageBox.Show("Complete");
            }
            else MessageBox.Show("Error");
        }

        private void btCount_Click(object sender, EventArgs e)
        {
            if (txtPathIn2.Text != "" && txtPathOut2.Text != "")
            {
                c = new Counter();
                c.readfile(txtPathIn2.Text);
                c.writefile(txtPathOut2.Text);
                MessageBox.Show("Complete");
            }
            else MessageBox.Show("Error");
        }

        private void btCountIf_Click(object sender, EventArgs e)
        {
            if (txtPathIn2.Text != "" && txtPathOut2.Text != "")
            {
                c = new Counter();
                c.count(txtPathIn2.Text);
                MessageBox.Show("Complete");
            }
            else MessageBox.Show("Error");
        }

        private void btCountgt4_Click(object sender, EventArgs e)
        {
            if (txtPathIn2.Text != "" && txtPathOut2.Text != "")
            {
                c = new Counter();
                c.count5a1(txtPathIn2.Text);
                MessageBox.Show("Complete");
            }
            else MessageBox.Show("Error");
        }

        

        private void button2_Click(object sender, EventArgs e)
        {
            if (txtPathIn2.Text != "" && txtPathOut2.Text != "")
            {
                c = new Counter();
                c.count12(txtPathIn2.Text,txtPathOut2.Text);
                MessageBox.Show("Complete");
            }
            else MessageBox.Show("Error");
        }

        private void button3_Click(object sender, EventArgs e)
        {
            if (txtPathIn2.Text != "" && txtPathOut2.Text != "")
            {
                c = new Counter();
                MessageBox.Show("Số câu: " + c.countsens(txtPathIn.Text));
            }
            else MessageBox.Show("Error");
        }

        private void button4_Click(object sender, EventArgs e)
        {
            if (txtPathIn2.Text != "")
            {
                c = new Counter();
                c.count3word(txtPathIn2.Text);
                MessageBox.Show("Complete");
            }
            else MessageBox.Show("Error");
        }
    }
}
